namespace Nintest.Sample.Production
{
    using System;

    public class MainViewModel
    {
        public MainViewModel()
        {
            Worklist = new WorklistViewModel();
            OpenDocuments = new OpenDocumentsViewModel();
            Notification = new NotificationViewModel();
        }

        public string UserName { get; private set; }

        public WorklistViewModel Worklist { get; private set; }

        public OpenDocumentsViewModel OpenDocuments { get; private set; }

        public string Language { get; set; }

        public NotificationViewModel Notification { get; private set; }

        public void Logon(string userName)
        {
            UserName = userName;
            Notification.Text = string.Format("Logged on as {0}", userName);
        }

        public TextDocumentViewModel CreateText()
        {
            var guid = Guid.NewGuid();
            var document = new TextDocumentViewModel
                               {
                                   Guid = guid,
                                   Title = string.Format("Text document {0}", guid),
                               };
            OpenDocuments.Add(document);
            return document;
        }
    }
}